package com.tentative.competition.common.model.schedule.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;

import java.util.Objects;

/**
 * @auther: Smile Huang
 * @date: 2023/6/24 16:52
 * @desc:
 * @version: 2.0
 */
@Data
public class PageVo {

    private Integer pageSize = 10;

    private Integer pageNum = 1;

    public Integer getPageSize() {
        if(Objects.isNull(pageSize)){
            pageSize = 10;
        }
        return pageSize;
    }

    public Integer getPageNum() {
        if(Objects.isNull(pageNum)){
            pageNum = 1;
        }
        return pageNum;
    }

    @ApiModelProperty(hidden = true)
    @JsonIgnore
    private Integer pageStart;

    public void setPageStart() {
        pageStart = (getPageNum() - 1) * getPageSize();
    }
}
